/*
Copyright 2020 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package controlplane

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
)

// GenericMachineTemplate contains a generic control plane spec.
type GenericMachineTemplate struct {
	Spec GenericMachineTemplateSpec `json:"spec"`
}

// GenericMachineTemplateSpec contains a generic control plane spec.
type GenericMachineTemplateSpec struct {
	InfrastructureRef clusterv1.ContractVersionedObjectReference `json:"infrastructureRef"`
}

// GenericControlPlaneSpec contains a generic control plane spec.
type GenericControlPlaneSpec struct {
	MachineTemplate GenericMachineTemplate `json:"machineTemplate"`
}

// +kubebuilder:object:root=true

// GenericControlPlane is a generic representation of a control plane.
type GenericControlPlane struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              GenericControlPlaneSpec `json:"spec,omitempty"`
}

// +kubebuilder:object:root=true

// GenericControlPlaneList is list of generic control planes.
type GenericControlPlaneList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []GenericControlPlane `json:"items"`
}

func init() {
	objectTypes = append(objectTypes, &GenericControlPlane{}, &GenericControlPlaneList{})
}
